import graphene
from flask import Flask
from flask_graphql import GraphQLView

class Query(graphene.ObjectType):
    uname = graphene.String(required=True)
    user_name = graphene.NonNull(graphene.String) # Exception: NonNull could not have a mounted String() as inner type. Try with NonNull(String).

    uname_list = graphene.List(graphene.String)
    uname_list2 = graphene.List(graphene.NonNull(graphene.String))
    uname_list3 = graphene.NonNull(graphene.List(graphene.String))

    def resolve_uname(self,info):
        return None
    def resolve_user_name(self,info):
        return None
    def resolve_uname_list(self,info):
        return None
    def resolve_uname_list2(self,info):
        return [None]
    def resolve_uname_list3(self,info):
        return [None]

if __name__ =='__main__':
    schema = graphene.Schema(query= Query)
    app = Flask(__name__)
    app.add_url_rule('/graphql',view_func=GraphQLView.as_view('grapql',schema=schema, graphiql=True))
    app.run(debug=True)